﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Esponce.Common;

namespace Esponce.QRCode
{
	[DataContract(Name = "qrcode", Namespace = "")]
	public class TrackQRCode : INotifyPropertyChanged
	{
		#region Public properties
		[DataMember(Name = "id", IsRequired = false, EmitDefaultValue = false, Order = 1)]
		public string Id
		{
			get
			{
				return this.id;
			}
			set
			{
				if (this.id != value)
				{
					this.id = value;
					OnPropertyChanged("Id");
				}
			}
		}
		private string id;

		[DataMember(Name = "campaignId", IsRequired = false, EmitDefaultValue = false, Order = 2)]
		public string CampaignId
		{
			get
			{
				return this.campaignId;
			}
			set
			{
				if (this.campaignId != value)
				{
					this.campaignId = value;
					OnPropertyChanged("CampaignId");
				}
			}
		}
		private string campaignId;

		[DataMember(Name = "name", IsRequired = false, EmitDefaultValue = false, Order = 3)]
		public string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				if (this.name != value)
				{
					this.name = value;
					OnPropertyChanged("Name");
				}
			}
		}
		private string name;

		[DataMember(Name = "comment", IsRequired = false, EmitDefaultValue = false, Order = 4)]
		public string Comment
		{
			get
			{
				return this.comment;
			}
			set
			{
				if (this.comment != value)
				{
					this.comment = value;
					OnPropertyChanged("Comment");
				}
			}
		}
		private string comment;

		[DataMember(Name = "urlinfo", IsRequired = false, EmitDefaultValue = false, Order = 5)]
		public string UrlInfo
		{
			get
			{
				return this.urlInfo;
			}
			set
			{
				if (this.urlInfo != value)
				{
					this.urlInfo = value;
					OnPropertyChanged("UrlInfo");
				}
			}
		}
		private string urlInfo;

		[DataMember(Name = "shortUrl", IsRequired = false, EmitDefaultValue = false, Order = 6)]
		public string ShortUrl
		{
			get
			{
				return this.shortUrl;
			}
			set
			{
				if (this.shortUrl != value)
				{
					this.shortUrl = value;
					OnPropertyChanged("ShortUrl");
				}
			}
		}
		private string shortUrl;

		[DataMember(Name = "imageUrl", IsRequired = false, EmitDefaultValue = false, Order = 7)]
		public string ImageUrl
		{
			get
			{
				return this.imageUrl;
			}
			set
			{
				if (this.imageUrl != value)
				{
					this.imageUrl = value;
					OnPropertyChanged("ImageUrl");
				}
			}
		}
		private string imageUrl;

		[DataMember(Name = "content", IsRequired = false, EmitDefaultValue = false, Order = 8)]
		public string Content
		{
			get
			{
				return this.content;
			}
			set
			{
				if (this.content != value)
				{
					this.content = value;
					OnPropertyChanged("Content");
				}
			}
		}
		private string content;

		[DataMember(Name = "scans", IsRequired = false, EmitDefaultValue = false, Order = 9)]
		public int? Scans
		{
			get
			{
				return this.scans;
			}
			set
			{
				if (this.scans != value)
				{
					this.scans = value;
					OnPropertyChanged("Scans");
				}
			}
		}
		private int? scans;

		[DataMember(Name = "recentScans", IsRequired = false, EmitDefaultValue = false, Order = 10)]
		public int? RecentScans
		{
			get
			{
				return this.recentScans;
			}
			set
			{
				if (this.recentScans != value)
				{
					this.recentScans = value;
					OnPropertyChanged("RecentScans");
				}
			}
		}
		private int? recentScans;

		[DataMember(Name = "isAvailable", IsRequired = false, EmitDefaultValue = false, Order = 11)]
		public bool? IsAvailable
		{
			get
			{
				return this.isAvailable;
			}
			set
			{
				if (this.isAvailable != value)
				{
					this.isAvailable = value;
					OnPropertyChanged("IsAvailable");
				}
			}
		}
		private bool? isAvailable;

		[DataMember(Name = "created", IsRequired = false, EmitDefaultValue = false, Order = 12)]
		public string CreatedISO8601
		{
			get
			{
				return ISO8601.GetString(this.Created);
			}
			set
			{
				this.Created = ISO8601.GetDateTime(value);
			}
		}

		public DateTime? Created
		{
			get
			{
				return this.created;
			}
			set
			{
				if (this.created != value)
				{
					this.created = value;
					OnPropertyChanged("Created");
				}
			}
		}
		private DateTime? created;

		[DataMember(Name = "location", IsRequired = false, EmitDefaultValue = false, Order = 13)]
		public GeoLocationModel Location
		{
			get
			{
				return this.location;
			}
			set
			{
				if (this.location != value)
				{
					this.location = value;
					OnPropertyChanged("Location");
				}
			}
		}
		private GeoLocationModel location;

		[DataMember(Name = "properties", IsRequired = false, EmitDefaultValue = false, Order = 14)]
		public QRCodeModel Properties
		{
			get
			{
				return this.properties;
			}
			set
			{
				if (this.properties != value)
				{
					this.properties = value;
					OnPropertyChanged("Properties");
				}
			}
		}
		private QRCodeModel properties;

		[DataMember(Name = "isScheduleEnabled", IsRequired = false, EmitDefaultValue = false, Order = 15)]
		public bool? IsScheduleEnabled
		{
			get
			{
				return this.isScheduleEnabled;
			}
			set
			{
				if (this.isScheduleEnabled != value)
				{
					this.isScheduleEnabled = value;
					OnPropertyChanged("IsScheduleEnabled");
				}
			}
		}
		private bool? isScheduleEnabled;

		[DataMember(Name = "schedule", IsRequired = false, EmitDefaultValue = false, Order = 16)]
		public List<ScheduleEventModel> Schedule
		{
			get
			{
				return this.schedule;
			}
			set
			{
				if (this.schedule != value)
				{
					this.schedule = value;
					OnPropertyChanged("Schedule");
				}
			}
		}
		private List<ScheduleEventModel> schedule;
		#endregion

		#region INotifyPropertyChanged Members
		public event PropertyChangedEventHandler PropertyChanged;
		protected virtual void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		#endregion
	}
}
